package com.shangguigu.spirngioc.ioc.config;

import com.shangguigu.spirngioc.ioc.bean.Person;
import com.shangguigu.spirngioc.ioc.condition.MacCondition;
import com.shangguigu.spirngioc.ioc.condition.WindowsCondition;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;

@Configuration
public class PersonConfig {

    @Bean("zhangsan")
    public Person zhangsan(){
        return new Person("张三",18,"男");
    }

    @Conditional(MacCondition.class)
    @Bean("qiaobusi")
    public Person qiaobusi(){
        return new Person("乔布斯",18,"男");
    }

    @Conditional(WindowsCondition.class)
    @Bean("biergaici")
    public Person biergaici(){
        return new Person("比尔盖茨",18,"男");
    }

}
